package binaryTree;

import java.util.ArrayList;
import java.util.List;

/**
 * @author kunkun
 * @className LeetCode_94
 * @Description ...
 * @date 2025/3/22 20:12
 */
public class LeetCode_94 {

    public class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;
        TreeNode() {}
        TreeNode(int val) { this.val = val; }
        TreeNode(int val, TreeNode left, TreeNode right) {
            this.val = val;
            this.left = left;
            this.right = right;
        }
    }

    public List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> list = new ArrayList<>();
        solution(root,list);
        return list;
    }

    public void solution(TreeNode root,List<Integer> list){
        if (root==null){
            return;
        }
        solution(root.left,list);
        list.add(root.val);
        solution(root.right,list);

    }


}
